package com.zmn.plat.common.dictionary;

/**
 * 渠道系数类型
 *
 * @author xiangjunming
 * @since 2020/03/31 14:56:30
 */
public enum ChannelRatioTypeEnum {

    /**
     * values 类型：102品牌系数 201服务分类系数 202产品一二级分类系数
     */
    BRAND_RATIO(102, "品牌系数"),
    SERV_CATEG_RATIO(201, "服务分类系数"),
    CATEG_RATIO(202, "产品一二级分类系数"),
    ;

    public static final int BRAND = 102;
    public static final int SERV_CATEG = 201;
    public static final int CATEG = 202;

    private Integer code;
    private String name;

    ChannelRatioTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelRatioTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 102:
                return BRAND_RATIO;
            case 201:
                return SERV_CATEG_RATIO;
            case 202:
                return CATEG_RATIO;
            default:
                return null;
        }
    }


}
